package com.sale.system.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sale.common.mybatis.core.mapper.BaseMapperPlus;
import com.sale.system.api.domain.dto.SysCustomerBalance;
import com.sale.system.domain.SysCustomerManagement;
import com.sale.system.domain.dto.SysCustomerManagementDto;
import com.sale.system.domain.vo.SysCustomerManagementVo;
import com.sale.system.export.CustomerManagementExport;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 客户mapper
 */
@Mapper
public interface SysCustomerManagementMapper extends BaseMapperPlus<SysCustomerManagementMapper, SysCustomerManagement, SysCustomerManagement> {

    /**
     * 客户列表
     *
     * @param sysCustomerManagementVo
     * @return
     */
    Page<SysCustomerManagementDto> getCoustomerList(@Param("page") Page<SysCustomerManagementDto> page, @Param("sysCustomerManagementVo") SysCustomerManagementVo sysCustomerManagementVo);


    /**
     * 获取客户编号
     *
     * @return
     */
    List<SysCustomerManagementDto> getCustomerNumMax();

    /**
     * 客户信息导出
     */
    List<CustomerManagementExport> getExportList(@Param("sysCustomerManagementVo") SysCustomerManagementVo sysCustomerManagementVo);

    /**
     * 根据多个id获取数据
     */
    List<CustomerManagementExport> getDataByIdStr(@Param("idList") List<String> idList);

    /**
     * 根据客户名称获取数据
     * @param customerName
     * @return
     */
    SysCustomerManagement getCustomerId(String customerName);

    /**
     * 获取单个客户数据
     */
    SysCustomerManagementDto getCustomerManagementById(Long id);

    /**
     * 获取启用状态客户
     */
    List<SysCustomerManagementDto> selectOpenCustomerList();

    /**
     * 通过客户名称获取客户编码(财务模块使用)
     */
    String getCodeByCustomerName(String customerName);

    /**
     * 通过客户编码更新余额
     */
    boolean updateClientBalance(SysCustomerBalance customerBalance);
}
